home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
351-375
/
361
/
xcolor-lib
/
xcolor-library.doc
< prev
next >
Wrap
Text File
|
1995-03-14
|
13KB
|
634 lines
XCOLOR-LIBRARY
Author: Roger Fischlin
Steigerwaldweg 6
6450 Hanau 7
West Germany
Phone : (06181) 650266
General
The XColor-Library gives you some functions for manipulating
colors, eg. a color requester.
Nearly all functions have a direct effect on the ColorMap,
so RemakeDisplay (Intuition-Library) has to be executed for
making the changes visible. There are two reasons for that :
· RemakeDisplay forbids multitasking !
· All changes get visible by once !
If you open the XColor-Library, you will also get the
pointers to the Graphics- , FFP- and Intuition-Library, that
are part of the XColor-Library base.
Copyright :
The XColor-Library is NO Public Domain. The Author, Roger
Fischlin, holds the copyright. The XColor-Library may be
distributed on PD-disks , if ...
· no profit is made !!!!
· no changes are made !
So you can include the Xcolor-Library with a PD-disk. This
text need not be included.
This library may be distributed with commercial software,
if ...
· no changes are made !
· this unchanged text is included !
Bugs
If there are any bugs, please send me an exact report.
include files
There are include files for
· DevPac Assember
· KickPascal
· C (by Oliver Wagner)
· AmigaBasic (by Oliver Wagner)
Instructions for the Usage of the colour requesters
As most functions should be evident, I just want to explain
four things :
1. RGB <-> HSV
By selecting RGB / HSV you can alternate between RGB-
and HSV-scale.
2. hex <-> decimal
Using the RGB-scale you can alternate between hexadecimal
and decimal display, the number of the color will be
diplayed hexadicimally (without $-character) or decimally,
too.
3. The Undo-gadget for the color that is displayed is on
the left side, above the number of the color.
4. All functions (COPY, SPREAD, EXCHANGE) may be canceled
by re-selecting.
Colour <-> Color
I used COLOUR when I wrote the library but I also have
added COLOR.
Functions of XColor.Library :
CheckColour
function : CheckColour
Offset : -30
Inputs : d0 - Number of colour (pen)
a0 - ^ViewPort
Return : 1 - EHB colour
0 - standard colour
-1 - colour doesn't exist
Purpose : This function returns the type of the colour.
ReadRGB4
function : ReadRGB4
Offset : -36
Inputs : d0 - Number of colour (pen)
a0 - ^ViewPort
Return : RGB - colorvalue (word)
-1 - no such color register
Purpose : This function returns the RGB values of the colour
as a word :
(R * 2^8) + (G * 2^4) + B
If this is an EHB-color, it will just be half as
bright as an usual one.
also look for : WriteRGB4
WriteRGB4
function : WriteRGB4
Offset : -42
Inputs : d0 - register of color
d1 - RGB-value as a word
a0 - ^ViewPort
Return : 0 - OK
-1 - no such register
Purpose : This function writes the colorvalue into the
ColorMap of the ViewPorts.
If this register is an EHB-color, the brightness
will be doubled and this RGB-value will be
written into the register, so the EHB-color
will have the RGB-value.
As this value is directly written into the
ColorMap, RemakeDisplay (Intuition-Library)has to
be executed.
also look for : ReadRGB4
ColorMapAddress
function : ColorMapAddress
Offset : -48
Inputs : d0 - kind of structure
a0 - ^structure
Return : <>0 - pointer to ColorMap
0 - wrong kind of structure
Purpose : This function gets the pointer to the ColorMap.
There are three possible structures :
0 : ViewPort
1 : Window
2 : Screen
ExchangeColours
function : ExchangeColours
Offset : -54
Inputs : d0 - register of the first color
d1 - register of the second color
a0 - ^ViewPort
Return : 0 - OK
-1 - no such register(s),
or these are different kinds of registers
(EHB and RGB)
Purpose : This function exchanges two values of the Color-
Map of the ViewPort.
If both registers are EHB-colors, the lower
registers belonging to each other will be
transfered.
As only the ColorMap is changed, the copperlist
must be rebuilt with RemakeDisplay (Intuition-
Library), before any change will be visible.
also look for : CopyColours, SpreadColours
CopyColours
function : CopyColours
Offset : -60
Inputs : d0 - register of the first color ( Source )
d1 - register of the second color ( Destination )
a0 - ^ViewPort
Return : 0 - OK
-1 - no such register(s),
or these are different kinds of registers
(EHB and RGB)
Purpose : This function copies the RGB-value of a register
to another of the ColorMap of the ViewPort.
If both registers are EHB-colors, the lower
registers belonging to each other will be
transfered.
As only the ColorMap is changed, the copperlist
must be rebuilt with RemakeDisplay (Intuition-
Library), before any change will be visible.
also look for : ExchangeColours, SpreadColours
SpreadColours
function : SpreadColours
Offset : -66
Inputs : d0 - register of the first color
d1 - register of the second color
a0 - ^ViewPort
Return : 0 - OK
-1 - no such register(s),
or these are different kinds of registers
(EHB and RGB)
Purpose : This function adepts the colors between the two
register of the ColorMap of the ViewPort to the
difference of them.
If both registers are EHB-colors, the lower
registers belonging to each other will be
changed.
As only the ColorMap is changed, the copperlist
must be rebuilt with RemakeDisplay (Intuition-
Library), before any change will be visible.
also look for : ExchangeColours, CopyColours
ColourDepth
function : ColourDepth
Offset : -72
Inputs : a0 - ^Screen
Return : Depth - depth of the screen ( HAM-Mode = 4 and
EHB-Mode = 6 ).
Purpose : This function gets log2 of the
number of color.
also look for : ColourNumber
ColourNumber
function : ColourNumber
Offset : -78
Inputs : a0 - ^Screen
Return : number- number of colors of a screen,
( HAM-Mode = 16 and EHB-Mode = 64 ).
Purpose : This function gets the number of colors.
also look for : ColourDepth
MakeAntique
function : MakeAntique
Offset : -84
Inputs : d0 - number of color (starting color)
d1 - number of registers
a0 - ^ViewPort
Return : 0 - OK
-1 - no such register
Purpose : This function makes the number of registers
from the starting color look antique.
As only the ColorMap is changed, the copperlist
must be rebuilt with RemakeDisplay (Intuition-
Library), before any change will be visible.
also look for : MakeBW
MakeBW
function : MakeBW
Offset : -90
Inputs : d0 - number of color (starting color)
d1 - number of register
a0 - ^ViewPort
Return : 0 - OK
-1 - no such register.
Purpose : This function makes the number of registers
from the starting color on look black and white.
As only the ColorMap is changed, the copperlist
must be rebuilt with RemakeDisplay (Intuition-
Library), before any change will be visible.
also look for : MakeAntique
CopyToBuffer
function : CopyToBuffer
Offset : -96
Inputs : d0 - number of color
d1 - number of registers
a0 - ^ViewPort
a1 - ^buffer
Return : number- number of copied registers
Purpose : This function copies the registers of the ColorMap
of the ViewPort to the buffer.
As only the ColorMap is changed, the copperlist
must be rebuilt with RemakeDisplay (Intuition-
Library), before any change will be visible.
also look for : CopyToColorMap
CopyToColorMap
function : CopyToColorMap
Offset : -102
Inputs : d0 - number of color (starting color)
d1 - number of registers
a0 - ^ViewPort
a1 - ^buffer
Return : number- number of copied register
Purpose : This function copies the values of the buffer
into the registers of the ColorMap of the Viewport
from the starting color on.
also look for : CopyToBuffer
HSVtoRGB
function : HSVtoRGB
Offset : -108
Inputs : d0 - H ($0000-$ffff)
d1 - S ($0000-$ffff)
d2 - V ($0000-$ffff)
Return : RGB - RGB-value from HSV-value (as a word).
Purpose : This function gets the RGB-value from the
HSV-value. Many painting programs (eg. DPaint) use
RGB-values and HSV-values.
also look for : RGBtoHSV
RGBtoHSV
function : RGBtoHSV
Offset : -114
Inputs : d0 - RGB as a word
a0 - ^buffer (3 longwords = 12 bytes)
Return : - HSV-value as a longword in the buffer
Purpose : This function gets the HSV-value from a RGB-value.
The HSV-values are to find seperated as longwords
($0000-$ffff) in the buffer
also look for : HSVtoRGB
ColourRequester
function : ColourRequester
Offset : -120
Inputs : a0 - ^colour requester structure
Return : 0 - OK
<0 - error
Purpose : The colour requester-function gives you
a palette for changing the colors. You can
create your own requester by using the options
and vectors.